//
//  VideoPlayerType.swift
//  VideoPlayer
//
//  Created by JY_NEW on 2021/10/8.
//

import Foundation
import AVFoundation

/// 播放器
public protocol VideoPlayerManagerType: AnyObject {
    ///浮层管理器
    var layerManager: VideoPlayerLayerManagerType { get }
    /// 事件通知统一管理
    var observer: VideoPlayerManagerObserverType { get }

    var status: VideoPlayerStatus { get }
    /// 网络状态
    var networkStatus: VideoPlayerNetworkStatus { get }
    
    var isFullScreen: Bool { get set }
    /// 是否允许自动旋转切换横竖屏，这个要ViewController配合
    var shouldAutorotate: Bool { get set }
    
    var rate: Float { get set }
    var volume: Float { get set }
    var brightness: Float { get set }
    
    var currentTime: TimeInterval { get set }
    var duration: TimeInterval { get }
    var playableDuration: TimeInterval { get }
    
    var url: URL? { get set }
    
    /// 跳转到指定时长
    func seek(to time: TimeInterval, completion: ((Bool) -> Void)?)

    func play()
    /// 从指定时间开始播放
    func play(from time: TimeInterval)
    func pause()
//    func stop()
    
    ///从pause(for:)方法记录的标识列表中删除该标志，若删完该标识后列表为空则调用播放，若列表中没有该标识或删除完不为空则不调用播放
    func play(for flag: Int)
    ///用指定标识暂停，跟play(for:)配套，每次使用该方法暂停会缓存一个标识列表记录所有通过该方法暂停的标识并暂停，若调用过正常的play或pause方法都会清空该列表
    func pause(for flag: Int)
    /// 用于检查是否使用过该标识调用过pause(for:),flag为nil则存在任意flag都为true 
    func isPaused(for flag: Int?) -> Bool
    
    var view: UIView { get }
    /// 显示模式
    var videoGravity: VideoPlayerGravity { get set }
}
